﻿@model CodeStash.Models.Snippet.CodeSnippetWrapperViewModel
@using CodeStash.Models.Snippet
@using CodeStash.ExtensionsMethods
@using CodeStash.Utils
<div id="codeSnippet-@Model.CodeSnippet.CodeSnippetId" class="snippet">
    <p>
        <strong>Title:&nbsp</strong>@Model.CodeSnippet.Title<br />
        <strong>Description:&nbsp</strong>@Model.CodeSnippet.Description<br />
        <strong>Category:&nbsp</strong>@Model.CodeSnippet.CodeCategory.CodeCategoryName<br />
        <strong>Visibility:&nbsp;</strong>@switch (Model.CodeSnippet.Visibility)
                                          {
                                              case 1:
            @:Only me
                                                  break;
                                              case 2:
            @:My team
                                                  break;
                                              default:
            @:Public
                                                          break;
                                          }<br />
        <strong>Added by:&nbsp;</strong>@Model.UserName on @Model.CodeSnippet.ModifiedDate.ToShortDateString()<br />
    </p>
    <p>
        @Html.Ratings(Model.CodeSnippet.CreateSnippetRatingModelFromFullSnippet())
    </p>
    <div class="singleSnippetBounds">
        <div class="highlightedSnippetHeader">
            <div class="snippetActionArea link">
                <img src="../../Content/images/link.png" width="25px" alt="" />
            </div>
            <div class="tooltip">
                Get link for this code snippet</div>
            <div class="snippetActionArea collapse">
                <img src="../../Content/images/collapse.png" width="25px" alt="" />
            </div>
            <div class="tooltip">
                Collapse code snippet</div>
            <div class="snippetActionArea expand">
                <img src="../../Content/images/expand.png" width="25px" alt="" />
            </div>
            <div class="tooltip">
                Expand code snippet</div>
            <div class="snippetActionArea tweet">
                <img src="../../Content/images/twitter_link.png" width="25px" alt="Tweet this snippet" />
            </div>
            <div class="tooltip">
                Tweet about this snippet</div>
            @if (Model.IsSnippetEditable)
            {
                <div class="snippetActionArea delete enabled">
                    <img src="../../Content/images/delete.png" width="25px" alt="" />
                </div>
                <div class="tooltip">
                    Delete code snippet</div>
       
                <div class="snippetActionArea edit enabled">
                    <img src="../../Content/images/edit.png" width="25px" alt="" />
                </div>
                <div class="tooltip">
                    Edit code snippet</div>
            }
            else
            {
                <div class="snippetActionArea delete disabled">
                    <img src="../../Content/images/deleteDisabled.png" width="25px" alt="" />
                </div>
                <div class="tooltip">
                    Delete code snippet</div>
       
                <div class="snippetActionArea edit disabled">
                    <img src="../../Content/images/editDisabled.png" width="25px" alt="" />
                </div>
                <div class="tooltip">
                    Edit code snippet</div>
            }
        </div>
        <div class="highlightedSnippet">
            @if (Model.CodeSnippet.Grouping != null)
            {
                <input class="isGrouped" type="hidden" value="true" />
                <input class="groupId" type="hidden" value="@Model.CodeSnippet.GroupId" />
                <input class="groupDescription" type="hidden" value="@Model.CodeSnippet.Grouping.Description" />
        
            }
            else
            {
                <input class="isGrouped" type="hidden" value="false" />
            }
            <input class="codeSnippetId" type="hidden" value="@Model.CodeSnippet.CodeSnippetId" />
            <pre class="brush: @CodeStash.Utils.WebSiteUtils.GetCodeClass(Model.CodeSnippet.Language.LanguageCode)">@Model.CodeSnippet.ActualCode.Trim()</pre>
        </div>
    </div>
    @*@Html.Partial("DisplayForumMessages", this.Model)*@
    <br />
</div>
